package cj.web.kly.service;
/*
 *  
 *  
*/
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cj.web.kly.domain.News;
import cj.web.kly.domain.Subject;
import cj.web.kly.dao.SubjectDAO;

/**
 * 
 * @author 
 *
 */
@Service
public class SubjectService{

	@Autowired
    private SubjectDAO subjectDAO;
	
	/**
	 * 查询news
	 * @param news
	 * @return newslis;size
	 */
	public Map queryNews(News news,String not_in_id){
		Map rep = new HashMap();
		List<News> newslis = subjectDAO.queryNewslis(news,not_in_id);
		int size = subjectDAO.queryNewslisSize(news,not_in_id); 
		rep.put("newslis", newslis);
		rep.put("size", size);
		return rep;
    }
	
	/**
	 * 查询
	 * @param subject
	 * @return subjectlis;size
	 */
	public Map query(Subject subject){
		Map rep = new HashMap();
		List<Subject> subjectlis = subjectDAO.query(subject);
		int size = subjectDAO.querySize(subject); 
		rep.put("subjectlis", subjectlis);
		rep.put("size", size);
		return rep;
    }
	
	public List<Subject> queryAll(){
		return subjectDAO.queryAll();
    }
	
	public Subject queryById(int id){
		Subject obj = subjectDAO.queryById(id);
		return obj;
    }
	
	public void create(Subject subject){
		subjectDAO.create(subject);
	}
	
	public void update(Subject subject){
		subjectDAO.update(subject);
	}
	
	public void deleteById(int id){
		subjectDAO.deleteById(id);
	}
	
	public void updateStatusById(int id){
		subjectDAO.updateStatusById(id);
	}
}